ajajform_htmltemplates.datentime={
    htmltemplate:	'<div class="af-label"></div>'+
					'<div class="af-edit">'+
						'<div class="hours"><select/></div>'+
						'<div class="dots">:</div>'+
						'<div class="minutes"><select/></div>'+
						'<div class="date"><input class="date"></div>'+
						'<div class="cl"></div>'+
						'<div class="af-error"></div>'+
					'</div>'+
					'<div class="cl"></div>'
};
(function( $, undefined ) {
	$.widget("ui.ajajform_datentime",$.ui.ajajform_widget, {      
		options: {
			cssclass: "afw-datentime"
		},
		_create: function() {
			var t = this;
			t.genericCreate();
			t.refreshLabel();
			t.initSelect();
		},
		initSelect:function(){
			var t = this;
			var hours_sel = $(".hours select",t.element);
				hours_sel.empty();
				
			var minutes_sel = $(".minutes select",t.element);
				minutes_sel.empty();
				
			for (var i = 0;i<=24;i++) {
				var h = (i>=10) ? i : '0'+i;
				$("<option></option>").appendTo(hours_sel).prop("value",h).text(h);				
			}
			for (var i = 0;i<=11;i++) {
				var m = i*5;
				if (m<10) m ='0'+m;
				
				$("<option></option>").appendTo(minutes_sel).prop("value",m).text(m);				
			}
			
			//$(hours_sel).styler({
			//	selectSearch:false,
			//	selectVisibleOptions:15		
			//});
			//$(minutes_sel).styler({
			//	selectSearch:false,
			//	selectVisibleOptions:15		
			//});
			
			$("input.date",t.element).datepicker({dateFormat: "dd.mm.yy"});
			
			if (t.options.value) {
				var date  = t.options.value.split(' ')[0];
				var hours  = t.options.value.split(' ')[1].split(':')[0];
				var minutes  = t.options.value.split(' ')[1].split(':')[1];
				$("input.date",t.element).val(date);
				$('.hours  .jq-selectbox__select-text',t.element).html(hours);
				$('.minutes  .jq-selectbox__select-text',t.element).html(minutes);
			}
			
			
			
			//$("input.date",t.element).val();
			//if (this.options.add_null) $("<option></option>").appendTo(sel1).prop("value","").text("");
			
		},
		postvalue: function(r) {
			var t = this;
			t.options.value = 	$('input.date',t.element).val()+' '+
								$('.hours select',t.element).val()+':'+
								$('.minutes select',t.element).val();
								
			
			r[t.options.name]=t.options.value;
		}
	});
})( jQuery );